import type { CreateBy, SysUser, Region } from '#/entity';
import { PageForm } from '../../interface';
import { UserOrderStatus, ReceiptType, LogisticsType } from '#/enum';
// 入库明细
export interface Stores {
  amount: number
  billNo: string
  condity: string
  fid: number
  materialId: string
  materialName: string
  realQty: number
  stockId: string
  unitPrice: number
}
export namespace UserOrder {

  export namespace Req {
    // 用户订单列表
    export interface UserOrderList extends PageForm {
      status: UserOrderStatus
    }


    // 确认价格
    export interface UserConfirmPrice {
      // 确认数量
      confirmNumber: number
      // 确认价格
      confirmPrice: number
    }
    // 修改物流
    export interface UserUpdateLogistics {
      // 物流类型
      logisticsType: LogisticsType,
      // 物流详情
      logisticsList?: {
        // 物流单号
        logisticsNumber: string,
        // 物流公司code
        logisticsCode: string,
        // 物流公司
        logisticsCompany: string
      }[],
      // RECEIVING,必填洪运订单form
      logisticsOrder?: {
        // 发件人姓名为必填
        sendName: string,
        // 发件人电话为必填
        sendPhone: string,
        // 发件人地址为必填
        sendAddress: string,
        // 发件人区域编码为必填
        regionCode: string
      }
    }
    // 修改上门信息
    export interface UserUpdateUpstairsInfo {
      // 寄件地址
      sendAddress: number
    }

    // 加盟商下单
    export interface FranchiseOrderCreate {
      // 订单类型
      orderType: string
      // 关联用户订单
      userOrder: string
      // 物流单号
      logisticsCode: string
      // 产品类型
      productType: string
      // 收款类型
      receiptType: string
      // 预估数量
      estimateNumber: string
      // 预估价格
      estimatePrice: string
      // 预估重量
      estimateWeight: string
    }
    // 加盟商列表
    export interface FranchiseList extends PageForm {
      status: string
    }
    // 加盟商下单
    export interface FranchiseOrderCreate {
      // 订单类型
      orderType: string
      // 关联用户订单
      userOrder: string
      // 物流单号
      logisticsCode: string
      // 产品类型
      productType: string
      // 收款类型
      receiptType: string
      // 预估数量
      estimateNumber: string,
      // 预估价格
      estimatePrice: string
      // 预估重量
      estimateWeight: string
    }
    // 下一步
    export interface FranchiseNextStep {
      id: string
    }
    // 上一步
    export interface FranchiseLastStep {
      id: string
    }
    // 取消订单
    export interface FranchiseCancelOrder {
      id: string
    }

  }
  export namespace Res {
    export interface Product {
      brand: string
      classification: string
      condition: string
      createAt: string
      customerOrderId: number
      dealPrice: number
      id: number
      num: number
      productVersionName: string
      thumbnail: string
      weight: number
    }
    // 物流信息
    export interface LogisticsDetail {
      logisticsNumber: string
      logisticsCode: string
      logisticsCompany: string
      logisticsOrderId?: string
    }
    // 用户订单列表
    export interface UserOrder {
      id: string
      sysUser: SysUser
      code: string
      status: string
      customer: string
      orderType: string
      productType: number
      recycleWay: number
      estimateNumber: number
      estimatePrice: number
      estimateWeight: number
      sendAddress: number
      receiveAddress: number
      receiptType: string
      receiptName: string
      receiptAccount: string
      identity: string
      belongBank: number
      createBy: SysUser
      createAt: string
      updateBy: SysUser
      updateAt: string
      qxtUserName: string
      qxtUserPhone: string
      confirmNumber?: number
      confirmPrice?: number
      source?: {
        WECHAT: string[]
        ALIPAY: string[]
        BANK: string[]
      }
      stores?: Stores[]
      receiptDetail?: {
        accountDirection: string
        accountName: string
        cardCode: string
        cardType: ReceiptType
        createTime: string
        delFlag: string
        id: string
        isDefault: number
        remark: string
        typeDefault: 0 | 1
        updateTime: string
        userId: number
      }
      products?: Product[] // 产品信息
      remark?: string
      logisticsDetail?: LogisticsDetail[]
      subStatus?: string
      alreadyPush?: boolean
      completeAt?: string
      logisticsType?: LogisticsType
    }

    // 用户订单列表
    export interface UserOrderList {
      data: UserOrder[]
      count: number
    }
    // 用户订单详情
    export interface UserOrderDetail extends UserOrder {
      logisticsCompany?: string
      logisticsNumber?: string
      logisticsCode?: string
      paymentOptions: {
        id: string
        sysUser: SysUser
        type: string
        realName: string
        realAccount: string
        identity: string
        belongBank: number
        isDefault: Boolean
        remark: string
        createBy: SysUser
        createAt: string
        source: SysUser
      }
    }
  }
}
